package com.cloud.thelen.wallpaper;

import android.content.Intent;
import android.view.View;

import com.cloud.thelen.wallpaper.BaseUI.BaseFragment;
import com.cloud.thelen.wallpaper.Data.Link;

import java.util.ArrayList;

public class ClassificationFragment extends BaseFragment {

    private View view1, view2, view3, view4, view5, view6, view7, view8, view9;

    @Override
    protected void initViews(View view) {
        super.initViews(view);
        view1 = view.findViewById(R.id.Celebrity);
        view2 = view.findViewById(R.id.starry);
        view3 = view.findViewById(R.id.Cartoon);
        view4 = view.findViewById(R.id.animal);
        view5 = view.findViewById(R.id.Fantasy);
        view6 = view.findViewById(R.id.Flower);
        view7 = view.findViewById(R.id.Landscape);
        view8 = view.findViewById(R.id.Games);
        view9 = view.findViewById(R.id.car);
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_classification;
    }

    @Override
    protected void setEvent() {
        onclickView(view1, view2, view3, view4, view5, view6, view7, view8, view9);
    }

    private void onclickView(View... views) {
        for (View view : views) {
            view.setOnClickListener(l -> {
                Intent intent = new Intent(getActivity(), WallpaperActivity.class);
                switch (view.getId()) {
                    case R.id.car:
                        intent.putStringArrayListExtra("links", (ArrayList) Link.getCar());
                        break;
                    case R.id.Games:
                        intent.putStringArrayListExtra("links", (ArrayList) Link.getGames());
                        break;
                    case R.id.starry:
                        intent.putStringArrayListExtra("links", (ArrayList) Link.getStarry());
                        break;
                    case R.id.Landscape:
                        intent.putStringArrayListExtra("links", (ArrayList) Link.getLandscape());
                        break;
                    case R.id.Flower:
                        intent.putStringArrayListExtra("links", (ArrayList) Link.getFlower());
                        break;
                    case R.id.animal:
                        intent.putStringArrayListExtra("links", (ArrayList) Link.getPet());
                        break;
                    case R.id.Cartoon:
                        intent.putStringArrayListExtra("links", (ArrayList) Link.getCartoon());
                        break;
                    case R.id.Celebrity:
                        intent.putStringArrayListExtra("links", (ArrayList) Link.getCelebrity());
                        break;
                    case R.id.Fantasy:
                        intent.putStringArrayListExtra("links", (ArrayList) Link.getFantasy());
                        break;
                }
                getActivity().startActivity(intent);
            });
        }
    }

    @Override
    protected void getData() {

    }
}
